The present invention relates to a method and apparatus for the directional smoothing of jagged edges in grey scale or colour images, in particular for text or graphics or any thin features.
Images represented in a pixel-based display often suffer from a staircase effect apparent in oblique lines and curves. This can adversely affect text readability, and especially the readability of small fonts applied to text. When an image is displayed at a higher resolution than the resolution with which it was generated, irregular edges can appear more pronounced.
For example, a ferro-electric liquid crystal display (FLCD) panel is capable of displaying text and natural image data at a standard screen resolution of 90 pixels per inch with a colour range of 4096 distinct colours. The panel is also capable of doubling the resolution with a consequently more limited colour range. Thus, it is possible to take advantage of the increased resolution to make text easier to read.
A number of conventional text enhancement systems rely on identifying predetermined patterns or features before modifying an image. For example, they modify the bitmap or pixel map depending on the positional relationships of background and foreground (text) pixels. This approach lacks generality and may not be able to handle exotic characters or particular graphics. Such a conventional technique assumes that the input data contains only text information. Alternatively, such a technique assumes that zone segmentation has previously discriminated between text data and natural image information. Moreover, the colour of the background and the foreground has to be known. Thus, such techniques are disadvantageous in that it is difficult to apply such techniques to complex images (eg., multiple text and background colours, or text on a natural background), or when no a priori colour information is available.
Alternatively, other conventional image processing methods like low-pass filtering can be used to smooth images. Such techniques do not depend on image content or colour information of an image. However, these techniques are not suitable for smoothing text and graphics, because they tend to blur high-contrast edges. The smoothing process should only be applied to jagged edges and preserve sharp discontinuities. Such conventional techniques disadvantageously smooth an image across all edges in the image.
Still further, conventional antialiasing techniques are often based on high-level information regarding image content such as geometrical shapes or character fonts. Consequently, such techniques are limited to applications where the features in a particular image are known and are disadvantageous in that image content is not always known and the image would have to be preprocessed to be reinterpreted at a higher level of abstraction.
A need clearly exists for an edge smoothing technique that overcomes one or more of the disadvantages of such conventional techniques. A general colour-independent, smoothing method is needed that can detect local edge information and avoid blurring sharp discontinuities. It is further desirable that such a technique preferably be capable of being applied to any kind of input data (ie. text, graphics or natural images), without prior segmentation to detect regions of interest or user intervention. A need exists for a technique that can smooth jagged lines, improve overall text appearance and readability, without blurring images or altering textures such as halftoned images.
In accordance with a first aspect of the invention, there is provided a method of smoothing jagged edges in graphical data. The method comprises steps of detecting one or more edges of a selected pixel in the graphical data dependent upon intensities of the selected pixel and another pixel surrounding a respective site of the one or more edges and predetermined gradients of at least the selected pixel and the respective site surrounding pixel, and applying an adapted convolution mask to the selected pixel and a predetermined neighbourhood of pixels containing the selected pixel, wherein coefficient values of the convolution mask are dependent upon the one or more detected edges.
Preferably, the detecting step is dependent upon a difference between the intensities of the selected pixel and the site surrounding pixel satisfying an intensity threshold. It may also be dependent upon an absolute value of the difference exceeding the intensity threshold.
The detecting step may be dependent upon the predetermined gradients of the selected pixel and the site surrounding pixel satisfying a gradient threshold. The predetermined gradients are either vertical or horizontal dependent upon the edge site being either horizontal or vertical, respectively. The predetermined gradients are either greater than the gradient threshold, or are less than the gradient threshold.
Preferably, the detecting step is dependent upon predetermined gradients of diagonal pixels in the neighbourhood satisfying a gradient threshold. The predetermined gradients of the selected pixel and the site surrounding pixel may be greater than the gradient threshold, and the predetermined gradients of the diagonal pixels may be less than the gradient threshold. Alternatively, the predetermined gradients of the selected pixel and the site surrounding pixel may be less than the gradient threshold, and the predetermined gradients of the diagonal pixels may be greater than the gradient threshold.
Preferably, if a single edge is detected, one or more coefficient values of a portion of the convolution mask corresponding to an edge containing the site surrounding pixel is set to a predetermined value. The predetermined value may be zero.
Preferably, if a double edge is detected, one or more coefficient values of each portion of the convolution mask corresponding to a respective edge containing one of the two site surrounding pixels are set to a predetermined value. The predetermined value may be zero.
Optionally, the method may comprise the step of, for a detected double edge, determining whether the selected pixel is a thickening pixel dependent upon a horizontal gradient and a vertical gradient of a pixel at the junction of the two edges satisfy respective gradient thresholds. One or more coefficient values of a portion of the convolution mask corresponding to each edge opposite to the detected double edges may be set to a predetermined value.
Preferably, the detecting step is carried out for each colour component of the selected pixel, and the one or more detected edges are dependent upon the largest intensity and gradient values of the colour components.
In accordance with a second aspect of the invention, there is provided a method of smoothing jagged edges in graphical data. The method comprises the steps of: determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, predetermined gradients dependent upon the respective edge site are an absolute local maxima, and predetermined gradients of diagonal pixels are not an absolute local maxima of the same sign as that of the neighbouring pixel; and modifying the target pixel using a filter having coefficient values dependent upon the one or more determined edges.
In accordance with a third aspect of the invention, there is disclosed a method of smoothing jagged edges in graphical data, the method comprising the steps of: determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, and predetermined gradients dependent upon the respective edge site are an absolute local maxima; and modifying the target pixel using a filter having coefficient values dependent upon the one or more determined edges.
In accordance with a fourth aspect of the invention, there is provided a method of smoothing jagged edges in graphical data, the method comprising the steps of: (a) detecting a plurality of zones of the graphical data dependent upon the values of a plurality of pixels contained in each zone, the zones each containing a minority of either bright or dark pixels or containing an equal number of bright and dark pixels; and (b) for each zone, filtering pixels of the zone, the zone filtering comprising the steps of:
if the bright and dark pixels are substantially equally present, applying antialiasing to the zone; if the dark pixels are in a minority in the zone, applying thickening to the zone; and if the bright pixels are in a minority in the zone, applying thickening to the zone with relevant gradients negated.
In accordance with a fifth aspect of the invention, there is provided an apparatus for smoothing jagged edges in graphical data, the apparatus comprising: means for detecting one or more edges of a selected pixel in the graphical data dependent upon intensities of the selected pixel and another pixel surrounding a respective site of the one or more edges and predetermined gradients of at least the selected pixel and the respective site surrounding pixel; and filtering means for applying an adapted convolution mask to the selected pixel and a predetermined neighbourhood of pixels containing the selected pixel, wherein coefficient values of the convolution mask are dependent upon the one or more detected edges.
In accordance with a sixth aspect of the invention, there is provided an apparatus for smoothing jagged edges in graphical data, the apparatus comprising: means for determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, predetermined gradients dependent upon the respective edge site are an absolute local maxima, and predetermined gradients of diagonal pixels are not an absolute local maxima of the same sign as that of the neighbouring pixel; and filtering means for modifying the target pixel, the filtering means having coefficient values dependent upon the one or more determined edges.
In accordance with a seventh aspect of the invention, there is provided an apparatus for smoothing jagged edges in graphical data, the apparatus comprising: means for determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, and predetermined gradients dependent upon the respective edge site are an absolute local maxima; and filter means for modifying the target pixel, the filter means having coefficient values dependent upon the one or more determined edges.
In accordance with an eighth aspect of the invention, there is provided an apparatus for smoothing jagged edges in graphical data, the apparatus comprising: means for detecting a plurality of zones of the graphical data dependent upon the values of a plurality of pixels contained in each zone, the zones each containing a minority of either bright or dark pixels or containing an equal number of bright and dark pixels; and means for filtering pixels of each zone, the zone filtering means further comprising:
means for antialiasing the zone if the bright and dark pixels are substantially equally present; and means for thickening the zone if the dark pixels are in a minority in the zone or if the bright pixels are in a minority in the zone.
In accordance with a ninth aspect of the invention, there is provided a computer program product including a computer readable medium having recorded thereon a computer program for smoothing jagged edges in graphical data, the computer program product comprising: means for detecting one or more edges of a selected pixel in the graphical data dependent upon intensities of the selected pixel and another pixel surrounding a respective site of the one or more edges and predetermined gradients of at least the selected pixel and the respective site surrounding pixel; and filtering means for applying an adapted convolution mask to the selected pixel and a predetermined neighbourhood of pixels containing the selected pixel, wherein coefficient values of the convolution mask are dependent upon the one or more detected edges.
In accordance with a tenth aspect of the invention, there is provided a computer program product including a computer readable medium having recorded thereon a computer program for smoothing jagged edges in graphical data, the computer program product comprising: means for determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, predetermined gradients dependent upon the respective edge site are an absolute local maxima, and predetermined gradients of diagonal pixels are not an absolute local maxima of the same sign as that of the neighbouring pixel; and filtering means for modifying the target pixel, the filtering means having coefficient values dependent upon the one or more determined edges.
In accordance with an eleventh aspect of the invention, there is provided a computer program product including a computer readable medium having recorded thereon a computer program for smoothing jagged edges in graphical data, the computer program product comprising: means for determining one or more edges if the intensities of a target pixel and a neighbouring pixel, both abutting a respective edge site, are substantially different, and predetermined gradients dependent upon the respective edge site are an absolute local maxima; and filter means for modifying the target pixel, the filter means having coefficient values dependent upon the one or more determined edges.
In accordance with a twelfth aspect of the invention, there is provided a computer program product including a computer readable medium having recorded thereon a computer program for smoothing jagged edges in graphical data, the computer program product comprising: means for detecting a plurality of zones of the graphical data dependent upon the values of a plurality of pixels contained in each zone, the zones each containing a minority of either bright or dark pixels or containing an equal number off bright and dark pixels; an means for filtering pixels of each zone, the zone filtering means further comprising:
means for antialiasing the zone if the bright and dark pixels are substantially equally present; means for thickening the zone if the dark pixels are in a minority in the zone or if the bright pixels are in a minority in the zone.